﻿using ArtMath.Resource;
using System.ComponentModel;

namespace ArtMath.Attribute
{
    public class MultilingualCategoryAttribute : CategoryAttribute
    {
        string format;
        string[] args;
        public string OriginalCategory { get; }
        public MultilingualCategoryAttribute(string category) : this(null, category)
        {

        }
        //public MultilingualCategoryAttribute(string format, string category) : this(category)
        //{
        //    this.format = format;
        //}
        public MultilingualCategoryAttribute(string format, params string[] args)
        {
            this.format = Resources.GetFormatString(format, args.Length);
            this.args = args;
            OriginalCategory = string.Concat(args);
        }
        protected override string GetLocalizedString(string value)
        {
            return Resources.GetLocalizedString(format, args);
        }
    }
}
